/****** Object:  StoredProcedure [dbo].GetAllDeliverableStatuses    Script Date: 03/12/2009 10:10:14 ******/
IF OBJECT_ID('dbo.GetAllDeliverableStatuses') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.GetAllDeliverableStatuses
    IF OBJECT_ID('dbo.GetAllDeliverableStatuses') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.GetAllDeliverableStatuses >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.GetAllDeliverableStatuses >>>'
END  
GO
-- =======================================================================
-- Procedure Name: dbo.GetAllDeliverableStatuses
--
-- Author:      Kevin Cashman, Parallax Consulting LLC
--
-- Create date: 03/12/09
--
-- Description: Returns list of Deliverable Statuses for Subcontract Reports
--
-- Parameters:  None
--              
-- Returns:     INT, 0=Success, -1=Error
--
-- SampleCall:
-- EXECUTE dbo.GetAllDeliverableStatuses()
--
--------------------------------------------------------------------------
-- Date        Initials  Modification
--------------------------------------------------------------------------
-- 03/12/09    RM		 Created based on the GetDeliverableTypes stored
--
-- =======================================================================

CREATE PROCEDURE [dbo].[GetAllDeliverableStatuses]
AS
BEGIN
     /*  Returned Fields for Dropdown
     --------------------------------
     DELSTAT             VARCHAR             
     DELSTATID           VARCHAR
     */

     -- Initial Settings
     SET NOCOUNT ON
     
     -- Declare Local Variables
     DECLARE   @Error            INT,
               @RowCount         INT

     -- Result Query    
     SELECT 'ALL'   AS DELSTAT,
               0    AS DELSTATID,
            'All' AS DELSTATDESC
     UNION
     SELECT 'Sub In - In Queue',
               1,
            'Sub In - In Queue'
     UNION
     SELECT 'Sub In - Assigned',
               2,
            'Sub In - Assigned'
     UNION
     SELECT 'Sub In - In Negotiation',
               3,
            'Sub In - In Negotiation'
     UNION
     SELECT 'Sub In - Pending GA',
               4,
            'Sub In - Pending GA'
     UNION
     SELECT 'Sub In - Pending Dept./PI Approval',
               5,
            'Sub In - Pending Dept./PI Approval'
     UNION
     SELECT 'Sub In - Partially Executed',
               6,
            'Sub In - Partially Executed'
     UNION  
--     SELECT 'Sub In - Fully Executed',
--               7,
--            'Sub In - Fully Executed'
--     UNION
--     SELECT 'Sub In - Other/Resolved',
--               8,
--            'Sub In - Other/Resolved'
--     UNION
     SELECT 'Sub In - Pending Docs from Dept./PI',
               9,
            'Sub In - Pending Docs from Dept./PI'
     UNION
	SELECT 'Sub In - Pending Out Yr',
               10,
            'Sub In - Pending Out Yr'
     UNION
	SELECT 'Sub In - Unexecuted Agreement Received',
               11,
            'Sub In - Unexecuted Agreement Received'
     UNION
	SELECT 'Sub Out - In Queue',
               12,
            'Sub Out - In Queue'
     UNION
	SELECT 'Sub Out - Assigned',
               13,
            'Sub Out - Assigned'
     UNION
	SELECT 'Sub Out - In Negotiation',
               14,
            'Sub Out - In Negotiation'
     UNION
	SELECT 'Sub Out - Pending GA',
               15,
            'Sub Out - Pending GA'
     UNION
	SELECT 'Sub Out - Pending Dept./PI Approval',
               16,
            'Sub Out - Pending Dept./PI Approval'
     UNION
	SELECT 'Sub Out - Partially Executed',
               17,
            'Sub Out - Partially Executed'
     UNION
--	SELECT 'Sub Out - Fully Executed',
--               18,
--            'Sub Out - Fully Executed'
--     UNION
--	SELECT 'Sub Out - Other/Resolved',
--               19,
--            'Sub Out - Other/Resolved'
--     UNION
	SELECT 'Sub Out - Pending Docs from Dept./PI',
               20,
            'Sub Out - Pending Docs from Dept./PI'
     UNION
	SELECT 'Sub Out - Pending Out Yr',
               21,
            'Sub Out - Pending Out Yr'
    UNION
	SELECT 'Sub Out - Requested',
               22,
            'Sub Out - Requested'
     ORDER BY DELSTATID              

     SELECT @Error=@@ERROR,@RowCount=@@ROWCOUNT
     IF @Error!=0
          RETURN -1

     -- Return Success
     RETURN 0
     
END
GO

IF OBJECT_ID('dbo.GetAllDeliverableStatuses') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.GetAllDeliverableStatuses >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.GetAllDeliverableStatuses >>>'
GO

GRANT EXECUTE ON dbo.GetAllDeliverableStatuses TO InsightReport,Insight
GO

